package com.example.unitestexample.service;

import com.example.unitestexample.entity.Employee;
import com.example.unitestexample.repository.EmployeeRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @author ME
 */
@RequiredArgsConstructor
@Service
public class EmployeeServiceImplWithContructorInject implements EmployeeService {

    private final EmployeeRepository employeeRepository;

    @Override
    public Optional<Employee> getEmployeeByName(String name) {
        return employeeRepository.findByName(name);
    }

    @Override
    public List<Employee> getAllEmployees() {
        return employeeRepository.findAll();
    }
}
